//
// Created by wze-zero on 2024/9/16 016.
//
#include <iostream>
#include <vector>

using namespace std;

int main() {
    int num, count = 0;
    vector<int> vec;
    cin >> num;
    for (int i = 2; i < num + 1; ++i) {
        vec.push_back(i);
    }
    for (vector<int>::iterator it = vec.begin(); it != vec.end(); ++it) {
        for (vector<int>::iterator i = it + 1; i != vec.end(); ++i) {
            if (*i != 0 && *it != 0 && *i % *it == 0) {
                *i = 0;
                count++;
            }
        }
    }
    for (vector<int>::iterator it = vec.begin(); it != vec.end(); ++it) {
        if (*it != 0) {
            cout << *it << " ";
        }
    }
    cout << endl << count << endl;
    return 0;
}